using namespace std;
#include<vector>
#include<iostream>

#include"Vector.h"

namespace syz
{
	template<class T>
	void print_vector(const vector<T>& v)
	{
		for (auto e : v)
		{
			cout << e << " ";
		}
		cout << endl;
	}

	void test1()
	{
		vector<int> v(3);

		cout << v.size() << ' ' << v.capacity() << endl;
		print_vector(v);
	}

	void test2()
	{
		vector<int> v1;
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);
		cout << v1.size() << ' ' << v1.capacity() << endl;
		print_vector(v1);

		vector<int>v2(v1.begin() + 1, v1.end() - 1);
		cout << v2.size() << ' ' << v2.capacity() << endl;
		print_vector(v2);
	}

	void test3()
	{
		const vector<int> v1(3, 10);
		/*v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);*/

		vector<int> v2(v1);
		cout << v2.size() << ' ' << v2.capacity() << endl;
		print_vector(v2);
	}

	void test4()
	{
		vector<int> v1(1,10);
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);

		cout << v1.size() << ' ' << v1.capacity() << endl;
		print_vector(v1);

		v1.pop_back();

		v1.pop_back();

		//v1.resize(0,999);
		cout << v1.size() << ' ' << v1.capacity() << endl;
		print_vector(v1);
	}

	void test5()
	{
		vector<int> v1;
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);

		vector<int>::iterator it = v1.begin();
		for (; it < v1.end(); it++)
		{
			if (it == v1.begin() + 1)
				it = v1.insert(it, 10);
		}
		print_vector(v1);
	}

	void test6()
	{
		vector<string> v1;
		v1.push_back("a");
		v1.push_back("b");
		v1.push_back("c");
		v1.push_back("d");

		v1.insert(v1.begin() + 1, "0");

		print_vector(v1);
	}

	void test7()
	{
		vector<int> v1;
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);

		v1.erase(v1.begin() + 1);

		print_vector(v1);
	}

	void test8()
	{
		vector<string> v;
		v.push_back("aaaaaa");
		v.push_back("bbbbbb");
		v.push_back("cccccc");
		v.push_back("dddddd");
		v.push_back("eeeeee");

		print_vector(v);

		v.push_back("ffffff");
		print_vector(v);
	}

	void test9()
	{
		vector<int> v;
		v.push_back(0);
		v.push_back(1);
		v.push_back(2);
		v.push_back(3);
		v.push_back(4);

		vector<int>::reverse_iterator rit = v.rbegin();
		while (rit != v.rend())
		{
			cout << *rit<<' ';
			++rit;
		}
	}
}

int main()
{
	syz::test9();

	return 0;
}

